// Vehicle repair script for AAS: Black Python
// Written by Superxpdude

private ["_player","_vehicle","_repairtime","_starttime","_animation"];

// Define variables to use in the script
_player = _this select 0;
_vehicle = _this select 1;
_animation = "inBaseMoves_RepairVehicleKnl"

// Check the current damage level of the vehicle, and calculate it's repair time
_repairtime = ceil ((damage _vehicle) * 60);

// Tell the player about the repair time
hint format ["Repair will take %1 seconds", _repairtime];

// Grab the time the repair was started
_starttime = time;

// Loop an animation while the player is repairing
while {time < (_starttime + _repairtime)} do {
	_player playMoveNow _animation;
	waitUntil {!(animationState _unit == _animation) or (time < (_starttime + _repairtime)};
};



// Repair the vehicle and stop the animation
_player playMoveNow "";
_vehicle setDamage 0;

// Tell the player that the repair is complete
hint format ["Repair complete", _repairtime];
